Text strings can include embedded formatting commands that facilitate subscripting, superscripting, and equation formatting. The method used is similar to that developed by Grandle and Nystrom (1980). Embedded formatting commands are always introduced by the exclamation mark, (!). (The string “!!” is used to produce a literal exclamation mark.)
Tip: Set the ENABLE_FORMATTING property on the IDLgrText object to use formatting commands in Object Graphics.
Note: Embedded formatting commands prefaced by the exclamation mark have no special significance for hardware-generated characters unless the ability is provided by the particular device in use. The IDL PostScript device driver accepts many of the standard embedded formatting commands, and is described here. If you wish to use hardware fonts with IDL Direct Graphics devices other than the PostScript device, consult the description of the device in “IDL Direct Graphics Devices” before trying to use these commands with hardware characters.
You can determine whether embedded formatting commands are available for use with device fonts on your current graphics device by inspecting bit 12 of the Flags field of the !D. Use the IDL statement:
IF (!D.FLAGS AND 4096) NE 0 THEN PRINT, 'Bit is set.'
to determine whether bit 12 of the Flags field is set for the current graphics device.
You can change fonts one or more times within a text string using the embedded font commands shown in the table below. The character following the exclamation mark can be either upper or lower case.
Examples of commands used to change fonts in mid-string are included in Formatting Command Examples.
Command |
Hershey Vector Font |
TrueType Font |
PostScript Font |
!3 |
Simplex Roman (default) |
Helvetica |
Helvetica |
!4 |
Simplex Greek |
Helvetica Bold |
Helvetica Bold |
!5 |
Duplex Roman |
Helvetica Italic |
Helvetica Narrow |
!6 |
Complex Roman |
Helvetica Bold Italic |
Helvetica Narrow Bold Oblique |
!7 |
Complex Greek |
Times |
Times Roman |
!8 |
Complex Italic |
Times Italic |
Times Bold Italic |
!9 |
Math/special characters |
Symbol |
Symbol |
!M |
Math/special characters |
Symbol |
Symbol |
!10 |
Special characters |
DejaVuSans |
Zapf Dingbats |
!11 or !G |
Gothic English |
Courier |
Courier |
!12 or !W |
Simplex Script |
Courier Italic |
Courier Oblique |
!13 |
Complex Script |
Courier Bold |
Palatino |
!14 |
Gothic Italian |
Courier Bold Italic |
Palatino Italic |
!15 |
Gothic German |
Times Bold |
Palatino Bold |
!16 |
Cyrillic |
Times Bold Italic |
Palatino Bold Italic |
!17 |
Triplex Roman |
Helvetica * |
Avant Garde Book |
!18 |
Triplex Italic |
Helvetica * |
New Century Schoolbook |
!19 |
|
Helvetica * |
New Century Schoolbook Bold |
!20 |
Miscellaneous |
Helvetica * |
Undefined User Font |
!X |
Revert to the entry font |
Revert to the entry font |
Revert to the entry font |
* The font assigned to this index may be replaced in a future release of IDL. |
The positioning and other font-manipulation commands are described in the following table. Examples of commands used to position text are included in Formatting Command Examples.
Command |
Action |
!A |
Shift above the division line. |
!B |
Shift below the division line. |
!C |
“Carriage return,” begins a new line of text. Shift back to the starting position and down one line. This command also performs an implicit “!N” command, returning to the normal level and character size at the beginning of the new line. |
!D |
Shift down to the first level subscript and decrease the character size by a factor of 0.62. |
!E |
Shift up to the exponent level and decrease the character size by a factor of 0.44. |
!I |
Shift down to the index level and decrease the character size by a factor of 0.44. |
!L |
Shift down to the second level subscript. Decrease the character size by a factor of 0.62. |
!M | Switch to the math/symbol font for one character, then switch back. |
!N |
Shift back to the normal level and original character size. |
!R |
Restore position. The current position is set from the top of the saved positions stack. |
!S |
Save position. The current position is saved on the top of the saved positions stack. |
!U |
Shift to upper subscript level. Decrease the character size by a factor of 0.62. |
!X |
Return to the entry font. |
!Z(u0,u1,...,un) |
Display one or more character glyphs according to their Unicode value. Each ui within the parentheses will be interpreted as a 16-bit hexadecimal Unicode value. If more than one Unicode value is to be included, the values should be separated by commas. |
!! |
Display the ! symbol. |